home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 July / macformat-079.iso / Shareware Plus / Development / ObjectPlant / 68k Object Plant / 68k Object Plant.rsrc / TEXT_128_EPS prep.txt < prev    next >
Encoding:
Text File  |  1999-03-24  |  59.0 KB  |  2,329 lines

  1.  
  2. /RE
  3. {
  4.     findfont begin
  5.     currentdict dup length dict begin
  6.     {
  7.         1 index /FID ne {def}{pop pop}ifelse
  8.     }forall
  9.     /FontName exch def dup length 0 ne
  10.     {
  11.         /Encoding Encoding 256 array copy def
  12.         0 exch
  13.         {
  14.             dup type /nametype eq
  15.             {
  16.                 Encoding 2 index 2 index put
  17.                 pop 1 add
  18.             }
  19.             {
  20.                 exch pop
  21.             }ifelse
  22.         }forall
  23.     }if pop
  24.     currentdict dup end end
  25.     /FontName get exch definefont pop
  26. } bind def
  27.  
  28. /stdencoding [
  29. 39/quotesingle 96/grave 128/Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis
  30. /Udieresis/aacute/agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute
  31. /egrave/ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde
  32. /oacute/ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex
  33. /udieresis/dagger/degree/cent/sterling/section/bullet/paragraph/germandbls
  34. /registered/copyright/trademark/acute/dieresis/.notdef/AE/Oslash
  35. /.notdef/plusminus/.notdef/.notdef/yen/mu/.notdef/.notdef
  36. /.notdef/.notdef/.notdef/ordfeminine/ordmasculine/.notdef/ae/oslash
  37. /questiondown/exclamdown/logicalnot/.notdef/florin/.notdef/.notdef
  38. /guillemotleft/guillemotright/ellipsis/.notdef/Agrave/Atilde/Otilde/OE/oe
  39. /endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide
  40. /.notdef/ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright
  41. /fi/fl/daggerdbl/periodcentered/quotesinglbase/quotedblbase/perthousand
  42. /Acircumflex/Ecircumflex/Aacute/Edieresis/Egrave/Iacute/Icircumflex
  43. /Idieresis/Igrave/Oacute/Ocircumflex/.notdef/Ograve/Uacute/Ucircumflex
  44. /Ugrave/dotlessi/circumflex/tilde/macron/breve/dotaccent/ring/cedilla
  45. /hungarumlaut/ogonek/caron
  46. ] def
  47. stdencoding /_Helvetica /Helvetica RE
  48. stdencoding /_Helvetica-Oblique /Helvetica-Oblique RE
  49. stdencoding /_Helvetica-Bold /Helvetica-Bold RE
  50. stdencoding /_Helvetica-BoldOblique /Helvetica-BoldOblique RE
  51.  
  52. /Monaco10 /_Helvetica findfont 10 scalefont def
  53. /MonacoI10 /_Helvetica-Oblique findfont 10 scalefont def
  54. /MonacoB10 /_Helvetica-Bold findfont 10 scalefont def
  55. /MonacoBI10 /_Helvetica-BoldOblique findfont 10 scalefont def
  56. /Monaco9 /_Helvetica findfont 9 scalefont def
  57. /MonacoI9 /_Helvetica-Oblique findfont 9 scalefont def
  58.  
  59. /defaultHeight 30 def /ifDefaultHeight 40 def /defaultWidth 60 def
  60. /pointSize 3 def /diamondWidth 8 def /pyramidWidth 18 def
  61. /eventBoxWidth 9 def
  62.  
  63. % oper1Name oper1Underline oper1Italic ... opernName opernUnderline opernItalic noOfOpers
  64. % attr1Name attr1Underline ... attrnName attrnUnderline noOfAttrs name abstract nested
  65.  
  66. /drawClassBox
  67. {
  68.     50 dict begin
  69.     /nested exch def /abstract exch def
  70.     /name exch def
  71.  
  72.     false abstract eq { MonacoB10 setfont }{ MonacoBI10 setfont } ifelse
  73.  
  74.     /maxwidth name stringwidth pop def
  75.     /boxwidth defaultWidth def
  76.  
  77.     /noOfAttr exch def
  78.     /AttrArray noOfAttr array def
  79.     /AttrUnderlineArray noOfAttr array def
  80.     /index noOfAttr 1 sub def
  81.     {
  82.         index -1 eq { exit } if
  83.         AttrUnderlineArray index 3 -1 roll put
  84.         AttrArray index 3 -1 roll put
  85.         /index index 1 sub def
  86.     } loop
  87.  
  88.     /noOfOper exch def
  89.     /OperArray noOfOper array def
  90.     /OperUnderlineArray noOfOper array def
  91.     /OperItalicArray noOfOper array def
  92.     /index noOfOper 1 sub def
  93.     {
  94.         index -1 eq { exit } if
  95.         OperItalicArray index 3 -1 roll put
  96.         OperUnderlineArray index 3 -1 roll put
  97.         OperArray index 3 -1 roll put
  98.         /index index 1 sub def
  99.     } loop
  100.  
  101.     % Set font size for attributes an operations while checking boxwidth
  102.     false abstract eq { Monaco9 setfont }{ MonacoI9 setfont } ifelse
  103.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  104.     AttrArray {
  105.         stringwidth pop 8 add dup
  106.         maxwidth gt { /maxwidth exch def }{ pop } ifelse
  107.     } forall
  108.     OperArray {
  109.         stringwidth pop 8 add dup
  110.         maxwidth gt { /maxwidth exch def }{ pop } ifelse
  111.     } forall
  112.  
  113.     % Set back font size for the class name
  114.     false abstract eq { MonacoB10 setfont }{ MonacoBI10 setfont } ifelse
  115.     maxwidth boxwidth 6 sub gt { /boxwidth maxwidth 6 add def } if
  116.     noOfAttr 0 ne { /boxheight noOfAttr 12 mul 26 add def } if
  117.     noOfOper 0 ne { noOfAttr 0 ne { /boxheight boxheight 6 add noOfOper 12 mul add def }
  118.                                     { /boxheight noOfOper 12 mul 26 add def } ifelse } if
  119.     noOfOper 0 eq { noOfAttr 0 eq { /boxheight defaultHeight def } if } if
  120.     boxheight defaultHeight lt { /boxheight defaultHeight def } if
  121.     nested true eq { [3] 0 setdash } if
  122.     currentpoint boxwidth 0 rlineto
  123.     0 boxheight neg rlineto
  124.     boxwidth neg 0 rlineto closepath gsave 1 setgray fill grestore stroke
  125.     nested true eq { [] 0 setdash } if
  126.  
  127.     noOfAttr 0 ne { leftmargin topmargin -18 add moveto boxwidth 0 rlineto stroke } if
  128.  
  129.     noOfOper 0 ne
  130.     {
  131.         newpath noOfAttr 0 ne { leftmargin topmargin -24 add noOfAttr -12 mul add moveto }
  132.                                     { leftmargin topmargin -20 add moveto }ifelse
  133.         boxwidth 0 rlineto stroke
  134.     }if
  135.     moveto currentpoint
  136.     boxwidth name stringwidth pop sub 2 div -14 rmoveto name show
  137.  
  138.     false abstract eq { Monaco9 setfont }{ MonacoI9 setfont } ifelse
  139.     currentpoint /index 0 def
  140.     AttrArray
  141.     { 
  142.         leftmargin 8 add topmargin moveto
  143.         0 -12 index mul -30 add rmoveto show
  144.  
  145. % Test of underline
  146.         AttrUnderlineArray index get true eq
  147.         {
  148.             0 -1 rmoveto
  149.             leftmargin 8 add -12 index mul -31 add topmargin add lineto stroke
  150.         } if
  151.         /index index 1 add def
  152.     } forall
  153.     moveto currentpoint /index 0 def
  154.     OperArray
  155.     {
  156.         leftmargin 8 add topmargin moveto
  157.         noOfAttr 0 ne
  158.         {
  159.             0 -12 index mul noOfAttr -12 mul add 38 sub rmoveto
  160.         }
  161.         {
  162.             0 -12 index mul 32 sub rmoveto
  163.         }ifelse
  164.         show
  165.  
  166. % Test of underline
  167.         OperUnderlineArray index get true eq
  168.         {
  169.             0 -1 rmoveto
  170.             leftmargin 8 add
  171.             noOfAttr 0 ne
  172.             {
  173.                 -12 index mul noOfAttr -12 mul add 39 sub
  174.             }
  175.             {
  176.                 -12 index mul 33 sub
  177.             }ifelse
  178.             topmargin add lineto stroke
  179.         } if
  180.          /index index 1 add def
  181.     } forall
  182.     leftmargin boxwidth add topmargin boxheight sub
  183.     end
  184. } def
  185. /drawInterfaceBox    % oper1 ... opern noOfOpers attr1 ... attrn noOfAttrs name drawInterfaceBox
  186. {
  187.     50 dict begin
  188.     /name exch def
  189.  
  190.     MonacoB10 setfont
  191.  
  192.     /maxwidth name stringwidth pop def
  193.     /boxwidth defaultWidth def
  194.  
  195.     /noOfAttr exch def /AttrArray noOfAttr array def /index noOfAttr 1 sub def {
  196.         index -1 eq { exit } if
  197.         AttrArray index 3 -1 roll put
  198.         /index index 1 sub def
  199.     } loop
  200.  
  201.     /noOfOper exch def /OperArray noOfOper array def /index noOfOper 1 sub def {
  202.         index -1 eq { exit } if
  203.         OperArray index 3 -1 roll put
  204.         /index index 1 sub def
  205.     } loop
  206.  
  207.     % Set font size for attributes an operations while checking boxwidth
  208.     Monaco9 setfont
  209.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  210.     AttrArray {
  211.         stringwidth pop 8 add dup
  212.         maxwidth gt { /maxwidth exch def }{ pop } ifelse
  213.     } forall
  214.     OperArray {
  215.         stringwidth pop 8 add dup
  216.         maxwidth gt { /maxwidth exch def }{ pop } ifelse
  217.     } forall
  218.  
  219.     MonacoB10 setfont
  220.     maxwidth boxwidth 6 sub gt { /boxwidth maxwidth 6 add def } if
  221.     noOfAttr 0 ne { /boxheight noOfAttr 12 mul 36 add def } if
  222.     noOfOper 0 ne { noOfAttr 0 ne { /boxheight boxheight 6 add noOfOper 12 mul add def }
  223.                                     { /boxheight noOfOper 12 mul 36 add def } ifelse } if
  224.     noOfOper 0 eq { noOfAttr 0 eq { /boxheight ifDefaultHeight def } if } if
  225.     boxheight ifDefaultHeight lt { /boxheight ifDefaultHeight def } if
  226.     currentpoint boxwidth 0 rlineto
  227.     0 boxheight  neg  rlineto
  228.     boxwidth neg 0 rlineto closepath gsave 1 setgray fill grestore stroke
  229.  
  230.     noOfAttr 0 ne { leftmargin topmargin -28 add moveto boxwidth 0 rlineto stroke } if
  231.  
  232.     noOfOper 0 ne
  233.     {
  234.         newpath noOfAttr 0 ne { leftmargin topmargin -34 add noOfAttr -12 mul add moveto }
  235.                                     { leftmargin topmargin -28 add moveto }ifelse
  236.         boxwidth 0 rlineto stroke
  237.     }if
  238.     moveto currentpoint
  239.     boxwidth name stringwidth pop sub 2 div -24 rmoveto name show
  240.     leftmargin topmargin moveto
  241.     boxwidth (¬´interface¬ª) stringwidth pop sub 2 div -14 rmoveto (¬´interface¬ª) show
  242.  
  243.     Monaco9 setfont
  244.     currentpoint /index 0 def
  245.     AttrArray
  246.     { 
  247.         leftmargin 8 add topmargin 10 sub moveto
  248.         0 -12 index mul -30 add rmoveto show
  249.         /index index 1 add def
  250.     } forall
  251.     moveto currentpoint /index 0 def
  252.     OperArray
  253.     {
  254.         leftmargin 8 add topmargin 10 sub moveto
  255.         noOfAttr 0 ne { 0 -12 index mul noOfAttr -12 mul add 38 sub rmoveto }
  256.         { 0 -12 index mul 32 sub rmoveto }ifelse show
  257.          /index index 1 add def
  258.     } forall
  259.     leftmargin boxwidth add topmargin boxheight sub
  260.     end
  261. } def
  262.  
  263. /arrowdict 15 dict def
  264. arrowdict begin
  265. /mtrx matrix def
  266. end
  267.  
  268. /drawArrow %     tailx taily tipx tipy halfthickness halfheadthickness headlength dashed filled drawArrow
  269. { arrowdict begin
  270.     /filled exch def
  271.     /dashed exch def
  272.     /headlength exch def
  273.     /halfheadthickness exch 2 div def
  274.     /halfthickness exch 2 div def
  275.     /tipy exch def /tipx exch def
  276.     /taily exch def /tailx exch def
  277.  
  278.     /dx tipx tailx sub def
  279.     /dy tipy taily sub def
  280.     /arrowlength dx dx mul dy dy mul add sqrt def
  281.     /angle dy dx atan def
  282.     /arrowlength arrowlength headlength add def
  283.     /base arrowlength headlength sub def
  284.     /savematrix mtrx currentmatrix def
  285.     tailx taily translate
  286.     angle rotate
  287.     base halfthickness neg moveto
  288.     base halfheadthickness neg lineto
  289.     arrowlength 0 lineto
  290.     base halfheadthickness lineto
  291.     base halfthickness lineto
  292.     closepath
  293.     filled true eq { fill }{ gsave 1 setgray fill grestore stroke } ifelse
  294.     savematrix setmatrix
  295.     newpath 1 setlinewidth
  296.     tailx taily translate
  297.     angle rotate
  298.     dashed true eq { [3] 0 setdash }if
  299.     0 0 moveto base 0 lineto stroke
  300.     dashed true eq { [] 0 setdash }if
  301.     savematrix setmatrix
  302.     end
  303. } def
  304.  
  305. /navarrowdict 15 dict def
  306. navarrowdict begin
  307. /mtrx matrix def
  308. end
  309.  
  310. /drawNavArrow %     tailx taily tipx tipy halfthickness halfheadthickness headlength dashed drawNavArrow
  311. { navarrowdict begin
  312.     /dashed exch def
  313.     /headlength exch def
  314.     /halfheadthickness exch 2 div def
  315.     /halfthickness exch 2 div def
  316.     /tipy exch def /tipx exch def
  317.     /taily exch def /tailx exch def
  318.  
  319.     /dx tipx tailx sub def
  320.     /dy tipy taily sub def
  321.     /arrowlength dx dx mul dy dy mul add sqrt halfthickness sub def
  322.     /angle dy dx atan def
  323.     /base arrowlength headlength sub def
  324.     /savematrix mtrx currentmatrix def
  325.     tailx taily translate
  326.     angle rotate
  327.     base halfheadthickness neg moveto
  328.     arrowlength 0 lineto
  329.     base halfheadthickness lineto
  330.     0 setgray stroke
  331.     savematrix setmatrix
  332.     newpath 1 setlinewidth
  333.     tailx taily translate
  334.     angle rotate
  335.     dashed true eq { [3] 0 setdash }if
  336.     0 0 moveto arrowlength 0 lineto stroke
  337.     dashed true eq { [] 0 setdash }if
  338.     savematrix setmatrix
  339.     end
  340. } def
  341.  
  342. /drawAssoc    % pointn ... point1 noOfPoints branchRole branchMultText branchMult branchQualPos branchQual branchNavi baseRole baseMultText baseMult baseQualPos baseQual baseNavi name
  343. {
  344.     50 dict begin
  345.     Monaco9 setfont
  346.  
  347.     /name exch def /baseNavi exch def /baseQual exch def /baseQualPos exch def /baseMult exch def /baseMultText exch def /baseRole exch def
  348.     /branchNavi exch def /branchQual exch def /branchQualPos exch def /branchMult exch def /branchMultText exch def /branchRole exch def
  349.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  350.     {
  351.         index noOfPoints 2 mul eq { exit } if
  352.         pntArray index 3 -1 roll put
  353.         /index index 1 add def
  354.     } loop
  355.  
  356. % Get the base qualifier's position
  357.     
  358.     /baseQualTW baseQual stringwidth pop def
  359.     /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  360.     /p1.v pntArray noOfPoints 1 sub 2 mul get def
  361.     /connect.h p1.h def
  362.     /connect.v p1.v def
  363.     baseQualPos 1 eq
  364.     {    % to the left of the first point
  365.         baseMult 1 eq {
  366.             /connect.h connect.h pointSize 2 div 2 add add def
  367.         } if
  368.         baseMult 2 eq {
  369.             /connect.h connect.h pointSize 2 div 2 add add def
  370.         } if
  371.     } if
  372.     baseQualPos 2 eq
  373.     {    % above the first point
  374.         baseMult 1 eq {
  375.             /connect.v connect.v pointSize 2 div 2 add sub def
  376.         } if
  377.         baseMult 2 eq {
  378.             /connect.v connect.v pointSize 2 div 2 add sub def
  379.         } if
  380.     } if
  381.     baseQualPos 3 eq
  382.     {    % to the right of the first point
  383.         baseMult 1 eq {
  384.             /connect.h connect.h pointSize 2 div 2 add sub def
  385.         } if
  386.         baseMult 2 eq {
  387.             /connect.h connect.h pointSize 2 div 2 add sub def
  388.         } if
  389.     } if
  390.     baseQualPos 4 eq
  391.     {    % below the first point
  392.         baseMult 1 eq {
  393.             /connect.v connect.v pointSize 2 div 2 add add def
  394.         } if
  395.         baseMult 2 eq {
  396.             /connect.v connect.v pointSize 2 div 2 add add def
  397.         } if
  398.     } if
  399.     baseQualPos 1 eq
  400.     {    % to the left of the first point
  401.         /p1.h connect.h baseQualTW 5 add sub def
  402.         /p1.v connect.v 3 sub def 
  403.     } if
  404.     baseQualPos 2 eq
  405.     {    % above the first point
  406.         /p1.h connect.h baseQualTW 2 div sub def
  407.         /p1.v connect.v 4 add def 
  408.     } if
  409.     baseQualPos 3 eq
  410.     {    % to the right of the first point
  411.         /p1.h connect.h 6 add def
  412.         /p1.v connect.v 3 sub def 
  413.     } if
  414.     baseQualPos 4 eq
  415.     {    % below the first point
  416.         /p1.h connect.h baseQualTW 2 div sub def
  417.         /p1.v connect.v 10 sub def
  418.     } if
  419.     /baseQualText.h p1.h def
  420.     /baseQualText.v p1.v def
  421.  
  422.     baseNavi 1 eq {
  423.         /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  424.         /p1.v pntArray noOfPoints 1 sub 2 mul get def
  425.         /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def
  426.         /p2.v pntArray noOfPoints 2 sub 2 mul get def
  427.         p2.h p2.v p1.h p1.v 1 5 5 false drawNavArrow
  428.     }if
  429.     branchNavi 1 eq {
  430.         /p1.h pntArray 1 get def
  431.         /p1.v pntArray 0 get def
  432.         /p2.h pntArray 3 get def
  433.         /p2.v pntArray 2 get def
  434.         p2.h p2.v p1.h p1.v 1 5 5 false drawNavArrow
  435.     }if
  436.  
  437.     /lineConnect.h connect.h def
  438.     /lineConnect.v connect.v def
  439.  
  440. % Determine the qualifiers rectangle size
  441.     baseQualTW 0 ne
  442.     {
  443.         baseQualPos 1 eq
  444.         {    % to the left of the first class
  445.             /RectRight connect.h def
  446.             /RectLeft baseQualText.h 5 sub def
  447.             /lineConnect.h RectLeft def
  448.             /RectTop baseQualText.v 12 add def
  449.             /RectBottom RectTop 16 sub def
  450.         } if
  451.         baseQualPos 3 eq
  452.         {    % to the right of the first class
  453.             /RectLeft connect.h def
  454.             /RectRight baseQualText.h baseQualTW 5 add add def
  455.             /lineConnect.h RectRight def
  456.             /RectTop baseQualText.v 12 add def
  457.             /RectBottom RectTop 16 sub def
  458.         } if
  459.         baseQualPos 2 eq
  460.         {    % above the first point
  461.             /RectBottom connect.v def
  462.             /RectTop RectBottom 16 add def
  463.             /lineConnect.v RectTop def
  464.             /RectLeft baseQualText.h 4 sub def
  465.             /RectRight RectLeft baseQualTW 9 add add def
  466.         } if
  467.         baseQualPos 4 eq
  468.         {    % below the first point
  469.             /RectTop connect.v def
  470.             /RectBottom RectTop 16 sub def
  471.             /lineConnect.v RectBottom def
  472.             /RectLeft baseQualText.h 4 sub def
  473.             /RectRight RectLeft baseQualTW add 9 add def
  474.         } if
  475.         RectLeft RectTop moveto
  476.         RectRight RectTop lineto
  477.         RectRight RectBottom lineto
  478.         RectLeft RectBottom lineto
  479.         closepath stroke
  480.         newpath
  481.         baseQualText.h baseQualText.v moveto
  482.         baseQual show
  483.     } if
  484.  
  485.     newpath 1 setlinewidth 0 setgray
  486.     /index 0 def
  487.     {
  488.         index noOfPoints eq { exit } if
  489.         pntArray index 2 mul 1 add get pntArray index 2 mul get
  490.         index noOfPoints 1 sub eq { pop pop lineConnect.h lineConnect.v } if
  491.         index 0 eq { moveto }{ lineto } ifelse
  492.         /index index 1 add def
  493.     } loop
  494.     stroke
  495.     /circle.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  496.     /circle.v pntArray noOfPoints 1 sub 2 mul get def
  497.     baseQualTW 0 ne
  498.     {
  499.         baseQualPos 1 eq
  500.         {    % to the left of the first class
  501.             /circle.h circle.h baseQualTW 9 add sub def
  502.         } if
  503.         baseQualPos 3 eq
  504.         {    % to the right of the first class
  505.             /circle.h circle.h baseQualTW 11 add add def
  506.         } if
  507.         baseQualPos 2 eq
  508.         {    % above the first point
  509.             /circle.v circle.v 16 add def
  510.         } if
  511.         baseQualPos 4 eq
  512.         {    % below the first point
  513.             /circle.v circle.v 16 sub def
  514.         } if
  515.     } if
  516.     circle.h circle.v
  517.     baseMult 1 eq {
  518.         % hollow circle
  519.         pointSize 0.5 sub 0 360 arc stroke
  520.         circle.h circle.v
  521.         pointSize 1 sub 0 360 arc 1 setgray fill
  522.     } if
  523.     baseMult 2 eq {
  524.         % filled circle
  525.         pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill
  526.     } if
  527.  
  528.     0 setgray /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  529.     /p1.v pntArray noOfPoints 1 sub 2 mul get def
  530.     /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def
  531.     /p2.v pntArray noOfPoints 2 sub 2 mul get def
  532.     /roletextwidth baseRole stringwidth pop def
  533.  
  534.     p1.h p2.h eq
  535.     { p1.v p2.v le
  536.         { p1.h 5 add p1.v 4 add baseQualTW 0 ne { 14 add } if }
  537.         { p1.h 5 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse
  538.     }
  539.     { p1.v p2.v eq
  540.         { p1.h p2.h gt
  541.                 { p1.h roletextwidth 5 add sub baseQualTW 0 ne { baseQualTW 9 add sub } if p1.v 10 sub }
  542.                 { p1.h 6 add baseQualTW 0 ne { baseQualTW 7 add add } if p1.v 10 sub } ifelse
  543.         }
  544.         {    p1.v p2.v le
  545.             {    p1.h p2.h gt
  546.                 { p1.h roletextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if }
  547.                 { p1.h 6 add p1.v 4 add baseQualTW 0 ne { 14 add } if } ifelse
  548.             }
  549.             {    p1.h p2.h gt
  550.                 { p1.h roletextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if }
  551.                 { p1.h 6 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse
  552.             } ifelse
  553.         } ifelse
  554.     } ifelse
  555.     moveto baseRole show
  556.     /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  557.     /p1.v pntArray noOfPoints 1 sub 2 mul get def
  558.     /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def
  559.     /p2.v pntArray noOfPoints 2 sub 2 mul get def
  560.     /multtextwidth baseMultText stringwidth pop def
  561.  
  562.     p1.h p2.h eq
  563.     { p1.v p2.v le
  564.             {    p1.h multtextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if }
  565.             {    p1.h multtextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse
  566.     }
  567.     { p1.v p2.v eq
  568.             { p1.h p2.h gt
  569.                     { p1.h multtextwidth 5 add sub baseQualTW 0 ne { baseQualTW 9 add sub } if p1.v 4 add }
  570.                     { p1.h 5 add baseQualTW 0 ne { baseQualTW 7 add add } if p1.v 4 add } ifelse
  571.             }
  572.             { p1.v p2.v le
  573.                     { p1.h p2.h gt
  574.                             { p1.h multtextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if }
  575.                             { p1.h 5 add p1.v 4 add baseQualTW 0 ne { 14 add } if } ifelse
  576.                     }
  577.                     { p1.h p2.h gt
  578.                             { p1.h multtextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if }
  579.                             { p1.h 5 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse
  580.                     } ifelse
  581.             } ifelse
  582.     } ifelse
  583.     moveto
  584.     baseMult 3 eq {
  585.         baseMultText show
  586.     } if
  587.  
  588.     newpath
  589.     % Get the branch qualifier's position
  590.  
  591.     /branchQualTW branchQual stringwidth pop def
  592.     /p1.h pntArray 1 get def
  593.     /p1.v pntArray 0 get def
  594.     /connect.h p1.h def
  595.     /connect.v p1.v def
  596.     branchQualPos 1 eq
  597.     {    % to the left of the first point
  598.         branchMult 1 eq {
  599.             /connect.h connect.h pointSize 2 div 2 add add def
  600.         } if
  601.         branchMult 2 eq {
  602.             /connect.h connect.h pointSize 2 div 2 add add def
  603.         } if
  604.         /p1.h connect.h branchQualTW 5 add sub def
  605.         /p1.v connect.v 3 sub def 
  606.     } if
  607.     branchQualPos 2 eq
  608.     {    % above the first point
  609.         branchMult 1 eq {
  610.             /connect.v connect.v pointSize 2 div 2 add sub def
  611.         } if
  612.         branchMult 2 eq {
  613.             /connect.v connect.v pointSize 2 div 2 add sub def
  614.         } if
  615.         /p1.h connect.h branchQualTW 2 div sub def
  616.         /p1.v connect.v 4 add def 
  617.     } if
  618.     branchQualPos 3 eq
  619.     {    % to the right of the first point
  620.         branchMult 1 eq {
  621.             /connect.h connect.h pointSize 2 div 2 add sub def
  622.         } if
  623.         branchMult 2 eq {
  624.             /connect.h connect.h pointSize 2 div 2 add sub def
  625.         } if
  626.         /p1.h connect.h 6 add def
  627.         /p1.v connect.v 3 sub def 
  628.     } if
  629.     branchQualPos 4 eq
  630.     {    % below the first point
  631.         branchMult 1 eq {
  632.             /connect.v connect.v pointSize 2 div 2 add add def
  633.         } if
  634.         branchMult 2 eq {
  635.             /connect.v connect.v pointSize 2 div 2 add add def
  636.         } if
  637.         /p1.h connect.h branchQualTW 2 div sub def
  638.         /p1.v connect.v 10 sub def
  639.     } if
  640.     /branchQualText.h p1.h def
  641.     /branchQualText.v p1.v def
  642.  
  643.     /lineConnect.h connect.h def
  644.     /lineConnect.v connect.v def
  645.  
  646. % Determine the qualifiers rectangle size
  647.     branchQualTW 0 ne
  648.     {
  649.         branchQualPos 1 eq
  650.         {    % to the left of the first class
  651.             /RectRight connect.h def
  652.             /RectLeft branchQualText.h 5 sub def
  653.             /lineConnect.h RectLeft def
  654.             /RectTop branchQualText.v 12 add def
  655.             /RectBottom RectTop 16 sub def
  656.         } if
  657.         branchQualPos 3 eq
  658.         {    % to the right of the first class
  659.             /RectLeft connect.h def
  660.             /RectRight branchQualText.h branchQualTW 5 add add def
  661.             /lineConnect.h RectRight def
  662.             /RectTop branchQualText.v 12 add def
  663.             /RectBottom RectTop 16 sub def
  664.         } if
  665.         branchQualPos 2 eq
  666.         {    % above the first point
  667.             /RectBottom connect.v def
  668.             /RectTop RectBottom 16 add def
  669.             /lineConnect.v RectTop def
  670.             /RectLeft branchQualText.h 4 sub def
  671.             /RectRight RectLeft branchQualTW 9 add add def
  672.         } if
  673.         branchQualPos 4 eq
  674.         {    % below the first point
  675.             /RectTop connect.v def
  676.             /RectBottom RectTop 16 sub def
  677.             /lineConnect.v RectBottom def
  678.             /RectLeft branchQualText.h 4 sub def
  679.             /RectRight RectLeft branchQualTW add 9 add def
  680.         } if
  681.         RectLeft RectTop moveto
  682.         RectRight RectTop lineto
  683.         RectRight RectBottom lineto
  684.         RectLeft RectBottom lineto
  685.         closepath gsave 1 setgray fill grestore stroke
  686.         newpath
  687.         branchQualText.h branchQualText.v moveto
  688.         branchQual show
  689.     } if
  690.     newpath
  691.     0 setgray
  692.     /circle.h pntArray 1 get def
  693.     /circle.v pntArray 0 get def
  694.     branchQualTW 0 ne
  695.     {
  696.         branchQualPos 1 eq
  697.         {    % to the left of the first class
  698.             /circle.h circle.h branchQualTW 9 add sub def
  699.         } if
  700.         branchQualPos 3 eq
  701.         {    % to the right of the first class
  702.             /circle.h circle.h branchQualTW 11 add add def
  703.         } if
  704.         branchQualPos 2 eq
  705.         {    % above the first point
  706.             /circle.v circle.v 16 add def
  707.         } if
  708.         branchQualPos 4 eq
  709.         {    % below the first point
  710.             /circle.v circle.v 16 sub def
  711.         } if
  712.     } if
  713.     circle.h circle.v
  714.     branchMult 1 eq {
  715.         % hollow circle
  716.         pointSize 0.5 sub 0 360 arc stroke
  717.         circle.h circle.v
  718.         pointSize 1 sub 0 360 arc 1 setgray fill
  719.     } if
  720.     branchMult 2 eq {
  721.         % filled circle
  722.         pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill
  723.     } if
  724.  
  725.     0 setgray
  726.     /p1.h pntArray 1 get def
  727.     /p1.v pntArray 0 get def
  728.     /p2.h pntArray 3 get def
  729.     /p2.v pntArray 2 get def
  730.     /roletextwidth branchRole stringwidth pop def
  731.  
  732.     p1.h p2.h eq
  733.     {    p1.v p2.v le
  734.         { p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if }
  735.         { p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse
  736.     }
  737.     { p1.v p2.v eq
  738.         {    p1.h p2.h gt
  739.             { p1.h roletextwidth 5 add sub branchQualTW 0 ne { branchQualTW 9 add sub } if p1.v 10 sub }
  740.             { p1.h 5 add branchQualTW 0 ne { branchQualTW 7 add add } if p1.v 10 sub } ifelse
  741.         }
  742.         {    p1.v p2.v le
  743.             {    p1.h p2.h gt
  744.                 {    p1.h roletextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if }
  745.                 {    p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if } ifelse
  746.             }
  747.             {    p1.h p2.h gt
  748.                 {    p1.h roletextwidth 5 add add p1.v 0 sub branchQualTW 0 ne { 14 sub } if }
  749.                 {    p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse
  750.             } ifelse
  751.         } ifelse
  752.     } ifelse
  753.     moveto branchRole show
  754.     /p1.h pntArray 1 get def
  755.     /p1.v pntArray 0 get def
  756.     /p2.h pntArray 3 get def
  757.     /p2.v pntArray 2 get def
  758.     /multtextwidth branchMultText stringwidth pop def
  759.  
  760.     p1.h p2.h eq
  761.     { p1.v p2.v le
  762.         {    p1.h multtextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if }
  763.         {    p1.h multtextwidth 5 add sub p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse
  764.      }
  765.      { p1.v p2.v eq
  766.             { p1.h p2.h gt
  767.                     { p1.h multtextwidth 5 add sub branchQualTW 0 ne { branchQualTW 9 add sub } if p1.v     4 add }
  768.                     { p1.h 5 add branchQualTW 0 ne { branchQualTW 7 add add } if p1.v 4 add } ifelse
  769.             }
  770.             { p1.v p2.v le
  771.                     { p1.h p2.h gt
  772.                             { p1.h multtextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if }
  773.                             { p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if } ifelse
  774.                     }
  775.                     { p1.h p2.h gt
  776.                             { p1.h multtextwidth 5 add sub p1.v 10 sub branchQualTW 0 ne { 14 sub } if }
  777.                             { p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse
  778.                     } ifelse
  779.             } ifelse
  780.     } ifelse
  781.     moveto
  782.     branchMult 3 eq {
  783.         branchMultText show
  784.     }if
  785.     end
  786. } def
  787.  
  788. /drawAggr    % [ pointn ... point1 noOfPoints branchRole branchMultText branchMult navigable ] noOfBranches 
  789.             % pointn ... point1 noOfPoints baseRole baseMultText baseMult navigable qualPos qualifier name byvalue diamondx diamondy
  790. {
  791.     70 dict begin
  792.     Monaco9 setfont
  793.  
  794.     /diay exch def
  795.     /diax exch def
  796.     /byvalue exch def
  797.     /name exch def /qualifier exch def /qualPos exch def /baseNavigable exch def /baseMult exch def /baseMultText exch def 
  798.     /baseRole exch def
  799.     /noOfStemPoints exch def
  800.     /stemArray noOfStemPoints 2 mul array def
  801.     /index 0 def
  802.     {
  803.         index noOfStemPoints 2 mul eq { exit } if
  804.         stemArray index 3 -1 roll put
  805.         /index index 1 add def
  806.     } loop
  807.  
  808. % Get the qualifier's position
  809.     
  810.     /qualTW qualifier stringwidth pop def
  811.     /p1.h stemArray noOfStemPoints 1 sub 2 mul 1 add get def
  812.     /p1.v stemArray noOfStemPoints 1 sub 2 mul get def
  813.     /connect.h p1.h def
  814.     /connect.v p1.v def
  815.     qualPos 1 eq
  816.     {    % to the left of the first point
  817.         /connect.h connect.h diamondWidth 0.5 add add def
  818.         /p1.h connect.h qualTW 5 add sub def
  819.         /p1.v connect.v 3 sub def 
  820.     } if
  821.     qualPos 2 eq
  822.     {    % above the first point
  823.         /connect.v connect.v diamondWidth 1 add sub def
  824.         /p1.h connect.h qualTW 2 div sub def
  825.         /p1.v connect.v 4 add def 
  826.     } if
  827.     qualPos 3 eq
  828.     {    % to the right of the first point
  829.         /connect.h connect.h diamondWidth sub def
  830.         /p1.h connect.h 6 add def
  831.         /p1.v connect.v 3 sub def 
  832.     } if
  833.     qualPos 4 eq
  834.     {    % below the first point
  835.         /connect.v connect.v diamondWidth 0.5 add add def
  836.         /p1.h connect.h qualTW 2 div sub def
  837.         /p1.v connect.v 10 sub def
  838.     } if
  839.     /qualText.h p1.h def
  840.     /qualText.v p1.v def
  841.  
  842.     /lineConnect.h connect.h def
  843.     /lineConnect.v connect.v def
  844.  
  845. % Determine the qualifiers rectangle size
  846.     qualTW 0 ne
  847.     {
  848.         qualPos 1 eq
  849.         {    % to the left of the first class
  850.             /RectRight connect.h def
  851.             /RectLeft qualText.h 5 sub def
  852.             /lineConnect.h RectLeft def
  853.             /RectTop qualText.v 12 add def
  854.             /RectBottom RectTop 16 sub def
  855.         } if
  856.         qualPos 3 eq
  857.         {    % to the right of the first class
  858.             /RectLeft connect.h def
  859.             /RectRight qualText.h qualTW 5 add add def
  860.             /lineConnect.h RectRight def
  861.             /RectTop qualText.v 12 add def
  862.             /RectBottom RectTop 16 sub def
  863.         } if
  864.         qualPos 2 eq
  865.         {    % above the first point
  866.             /RectBottom connect.v def
  867.             /RectTop RectBottom 16 add def
  868.             /lineConnect.v RectTop def
  869.             /RectLeft qualText.h 4 sub def
  870.             /RectRight RectLeft qualTW 9 add add def
  871.         } if
  872.         qualPos 4 eq
  873.         {    % below the first point
  874.             /RectTop connect.v def
  875.             /RectBottom RectTop 16 sub def
  876.             /lineConnect.v RectBottom def
  877.             /RectLeft qualText.h 4 sub def
  878.             /RectRight RectLeft qualTW add 9 add def
  879.         } if
  880.         RectLeft RectTop moveto
  881.         RectRight RectTop lineto
  882.         RectRight RectBottom lineto
  883.         RectLeft RectBottom lineto
  884.         closepath stroke
  885.         newpath
  886.         qualText.h qualText.v moveto
  887.         qualifier show
  888.     } if
  889.  
  890.     /noOfBranches exch def /branchesArray noOfBranches array def /index 0 def
  891.     {
  892.         index noOfBranches eq { exit } if
  893.         /branchNavigable exch def
  894.         /branchMult exch def /branchMultText exch def
  895.         /branchRole exch def /noOfBranchPoints exch def
  896.  
  897.         noOfBranchPoints 0 ne {
  898.             /pntArray noOfBranchPoints 2 mul array def
  899.             /pntIndex 0 def
  900.             {
  901.                 pntIndex noOfBranchPoints 2 mul eq { exit } if
  902.                 pntArray pntIndex 3 -1 roll put
  903.                 /pntIndex pntIndex 1 add def
  904.             } loop
  905.  
  906.             /branchArray 6 array def
  907.              branchArray 0 branchMult put branchArray 1 branchMultText put
  908.             branchArray 2 branchRole put branchArray 3 noOfBranchPoints put
  909.             branchArray 4 branchNavigable put branchArray 5 pntArray put
  910.          }
  911.          {
  912.              /branchArray 5 array def
  913.             branchArray 0 branchMult put branchArray 1 branchMultText put
  914.             branchArray 2 branchRole put branchArray 3 noOfBranchPoints put
  915.             branchArray 4 branchNavigable put
  916.         } ifelse
  917.         branchesArray index branchArray put
  918.         /index index 1 add def
  919.     } loop
  920.     newpath 1 setlinewidth 0 setgray
  921.  
  922.     /p1.h stemArray noOfStemPoints 1 sub 2 mul 1 add get def
  923.     /p1.v stemArray noOfStemPoints 1 sub 2 mul get def
  924.     /p2.h stemArray noOfStemPoints 2 sub 2 mul 1 add get def
  925.     /p2.v stemArray noOfStemPoints 2 sub 2 mul get def
  926.     baseNavigable 1 eq
  927.     {
  928.         p2.h p2.v p1.h p1.v 1 5 5 false drawNavArrow
  929.     }if
  930.  
  931.     /index 0 def
  932.     {
  933.         index noOfStemPoints eq { exit } if
  934.         stemArray index 2 mul 1 add get stemArray index 2 mul get
  935. %        index noOfStemPoints 1 sub eq { pop pop lineConnect.h lineConnect.v } if
  936.         index 0 eq { moveto }{ lineto } ifelse
  937.         /index index 1 add def
  938.     } loop
  939.     branchesArray
  940.     {
  941.         /branch exch def /branchMult branch 0 get def
  942.         /branchNavigable branch 4 get def
  943.         /branchMultText branch 1 get def /noOfPoints branch 3 get def
  944.         noOfPoints 0 ne {
  945.             /pntArray branch 5 get def
  946.             /index 0 def
  947.             {
  948.                 index noOfPoints eq { exit } if
  949.                 pntArray index 2 mul 1 add get pntArray index 2 mul get
  950.                 index 0 eq {
  951.                     branchNavigable 1 eq {
  952.                         pntArray 3 get pntArray 2 get pntArray 1 get pntArray 0 get 1 5 5 false drawNavArrow
  953.                     }if
  954.                     moveto
  955.                 }{
  956.                     lineto
  957.                 } ifelse
  958.                 /index index 1 add def
  959.             } loop
  960.         } if
  961.     }forall
  962.     stroke
  963.     branchesArray
  964.     {
  965.         /branch exch def
  966.         /branchMult branch 0 get def /branchMultText branch 1 get def
  967.         /branchRole branch 2 get def /noOfPoints branch 3 get def
  968.         noOfPoints 0 ne {
  969.             /pntArray branch 5 get def
  970.             newpath
  971.             /p1.h pntArray 1 get def /p1.v pntArray 0 get def
  972.             /p2.h pntArray 3 get def /p2.v pntArray 2 get def
  973.         }
  974.         {
  975.             newpath
  976.             /p1.h stemArray 1 get def /p1.v stemArray 0 get def
  977.             /p2.h stemArray 3 get def /p2.v stemArray 2 get def
  978.         } ifelse
  979.  
  980.         0 setgray
  981.  
  982.         p1.h p1.v
  983.         branchMult 1 eq {
  984.             % hollow circle
  985.             pointSize 0.5 sub 0 360 arc stroke
  986.             p1.h p1.v
  987.             pointSize 1 sub 0 360 arc 1 setgray fill
  988.         } if
  989.         branchMult 2 eq {
  990.             % filled circle
  991.             pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill
  992.         } if
  993.  
  994.         0 setgray
  995.         /roletextwidth branchRole stringwidth pop def
  996.  
  997.         p1.h p2.h eq
  998.         {    p1.v p2.v le
  999.             {    p1.h 5 add    p1.v 4 add }{ p1.h 5 add p1.v 10 sub } ifelse
  1000.         }
  1001.         { p1.v p2.v eq
  1002.             {    p1.h p2.h gt
  1003.                 { p1.h roletextwidth 5 add sub p1.v 10 sub }{ p1.h 5 add p1.v 10 sub } ifelse
  1004.             }
  1005.             {    p1.v p2.v le
  1006.                 {    p1.h p2.h gt
  1007.                     {    p1.h roletextwidth 5 add sub p1.v 4 add }{    p1.h 5 add p1.v 4 add } ifelse
  1008.                 }
  1009.                 {    p1.h p2.h gt
  1010.                     {    p1.h roletextwidth 5 add add p1.v 0 sub }
  1011.                     {    p1.h 5 add p1.v 10 sub } ifelse
  1012.                 } ifelse
  1013.             } ifelse
  1014.         } ifelse
  1015.         moveto branchRole show
  1016.  
  1017.         noOfPoints 0 ne {
  1018.             /pntArray branch 5 get def
  1019.             newpath
  1020.             /p1.h pntArray 1 get def /p1.v pntArray 0 get def
  1021.             /p2.h pntArray 3 get def /p2.v pntArray 2 get def
  1022.         }
  1023.         {
  1024.             newpath
  1025.             /p1.h stemArray 1 get def /p1.v stemArray 0 get def
  1026.             /p2.h stemArray 3 get def /p2.v stemArray 2 get def
  1027.         } ifelse
  1028.         /multtextwidth branchMultText stringwidth pop def
  1029.         0 setgray
  1030.  
  1031.         p1.h p2.h eq
  1032.         { p1.v p2.v le
  1033.             {    p1.h multtextwidth 5 add sub p1.v 4 add }
  1034.             {    p1.h multtextwidth 5 add sub p1.v 10 sub }     ifelse
  1035.         }
  1036.         { p1.v p2.v eq
  1037.             { p1.h p2.h gt
  1038.                 { p1.h multtextwidth 5 add sub p1.v 4 add }{ p1.h 5 add p1.v 4 add } ifelse
  1039.             }
  1040.             { p1.v p2.v le
  1041.                 { p1.h p2.h gt
  1042.                     { p1.h multtextwidth 5 add sub p1.v 4 add }{ p1.h 5 add p1.v 4 add } ifelse
  1043.                 }
  1044.                 { p1.h p2.h gt
  1045.                     { p1.h multtextwidth 5 add sub p1.v 10 sub }{ p1.h 5 add p1.v 10 sub } ifelse
  1046.                 } ifelse
  1047.             } ifelse
  1048.         } ifelse
  1049.         moveto
  1050.         branchMult 3 eq {
  1051.             branchMultText show
  1052.         }if
  1053.  
  1054.     }forall
  1055.     stroke
  1056.  
  1057.     0 setgray
  1058.     /p1.h stemArray noOfStemPoints 1 sub 2 mul 1 add get def
  1059.     /p1.v stemArray noOfStemPoints 1 sub 2 mul get def
  1060.     /p2.h stemArray noOfStemPoints 2 sub 2 mul 1 add get def
  1061.     /p2.v stemArray noOfStemPoints 2 sub 2 mul get def
  1062.     /roletextwidth baseRole stringwidth pop def
  1063.  
  1064.     p1.h p2.h eq
  1065.     { p1.v p2.v le
  1066.         { p1.h 5 add p1.v 1 sub qualTW 0 ne { 14 add } if }
  1067.         { p1.h 5 add p1.v 1 sub qualTW 0 ne { 14 sub } if } ifelse
  1068.     }
  1069.     { p1.v p2.v eq
  1070.         { p1.h p2.h gt
  1071.                 { p1.h roletextwidth 1 sub sub qualTW 0 ne { qualTW 9 add sub } if p1.v 10 sub }
  1072.                 { p1.h 1 sub qualTW 0 ne { qualTW 7 add add } if p1.v 10 sub } ifelse
  1073.         }
  1074.         {    p1.v p2.v le
  1075.             {    p1.h p2.h gt
  1076.                 { p1.h roletextwidth 5 add sub p1.v 4 add qualTW 0 ne { 14 add } if }
  1077.                 { p1.h 6 add p1.v 4 add qualTW 0 ne { 14 add } if } ifelse
  1078.             }
  1079.             {    p1.h p2.h gt
  1080.                 { p1.h roletextwidth 5 add sub p1.v 10 sub qualTW 0 ne { 14 sub } if }
  1081.                 { p1.h 6 add p1.v 10 sub qualTW 0 ne { 14 sub } if } ifelse
  1082.             } ifelse
  1083.         } ifelse
  1084.     } ifelse
  1085.     moveto baseRole show
  1086.  
  1087.     newpath
  1088.     p1.h p2.h eq
  1089.     { p1.v p2.v le
  1090.             { p1.h p1.v 3 add qualTW 0 ne { 15 add } if }
  1091.             { p1.h p1.v 3 sub qualTW 0 ne { 16 sub } if } ifelse
  1092.     }
  1093.     { p1.v p2.v eq
  1094.             { p1.h p2.h gt
  1095.                     { p1.h 2 sub qualTW 0 ne { qualTW 10 add sub } if p1.v }
  1096.                     { p1.h 2 add qualTW 0 ne { qualTW 12 add add } if p1.v } ifelse
  1097.             }
  1098.             { p1.v p2.v le
  1099.                     { p1.h p2.h gt
  1100.                             { p1.h pointSize 5 add sub p1.v 4 add qualTW 0 ne { 15 add } if }
  1101.                             { p1.h 5 add p1.v 4 add qualTW 0 ne { 15 add } if } ifelse
  1102.                     }
  1103.                     { p1.h p2.h gt
  1104.                             { p1.h pointSize 5 add sub p1.v 10 sub qualTW 0 ne { 15 sub } if }
  1105.                             { p1.h 5 add p1.v 10 sub qualTW 0 ne { 15 sub } if } ifelse
  1106.                     } ifelse
  1107.             } ifelse
  1108.     } ifelse
  1109.     /y exch def
  1110.     /x exch def
  1111.     x y
  1112.     baseMult 1 eq {
  1113.         % hollow circle
  1114.         pointSize 0.5 sub 0 360 arc stroke
  1115.         x y
  1116.         pointSize 1 sub 0 360 arc 1 setgray fill
  1117.     } if
  1118.     baseMult 2 eq {
  1119.         % filled circle
  1120.         pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill
  1121.     } if
  1122.  
  1123.     /multtextwidth baseMultText stringwidth pop def
  1124.  
  1125.     p1.h p2.h eq
  1126.     { p1.v p2.v le
  1127.             {    p1.h multtextwidth 5 add sub p1.v 1 sub qualTW 0 ne { 14 add } if }
  1128.             {    p1.h multtextwidth 5 add sub p1.v 1 sub qualTW 0 ne { 14 sub } if }     ifelse
  1129.     }
  1130.     { p1.v p2.v eq
  1131.             { p1.h p2.h gt
  1132.                     { p1.h multtextwidth 1 sub sub qualTW 0 ne { qualTW 9 add sub } if p1.v 4 add }
  1133.                     { p1.h 1 sub qualTW 0 ne { qualTW 7 add add } if p1.v 4 add } ifelse
  1134.             }
  1135.             { p1.v p2.v le
  1136.                     { p1.h p2.h gt
  1137.                             { p1.h multtextwidth 5 add sub p1.v 4 add qualTW 0 ne { 14 add } if }
  1138.                             { p1.h 5 add p1.v 4 add qualTW 0 ne { 14 add } if } ifelse
  1139.                     }
  1140.                     { p1.h p2.h gt
  1141.                             { p1.h multtextwidth 5 add sub p1.v 10 sub qualTW 0 ne { 14 sub } if }
  1142.                             { p1.h 5 add p1.v 10 sub qualTW 0 ne { 14 sub } if } ifelse
  1143.                     } ifelse
  1144.             } ifelse
  1145.     } ifelse
  1146.     moveto
  1147.     baseMult 3 eq {
  1148.         baseMultText show
  1149.     } if
  1150.  
  1151.     newpath 1 setlinewidth
  1152.     qualTW 0 ne
  1153.     {
  1154.         qualPos 1 eq
  1155.         {
  1156.             /diax diax qualTW 9 add sub def
  1157.         } if
  1158.         qualPos 2 eq
  1159.         {
  1160.             /diay diay 16 add def
  1161.         } if
  1162.         qualPos 3 eq
  1163.         {
  1164.             /diax diax qualTW 11 add add def
  1165.         } if
  1166.         qualPos 4 eq
  1167.         {
  1168.             /diay diay 16 sub def
  1169.         } if
  1170.     } if
  1171.  
  1172.     diax diamondWidth 2 div sub 0.5 add diay moveto
  1173.  
  1174.     diamondWidth 2 div 1 sub diamondWidth 2 div 1 sub rlineto
  1175.     diamondWidth 2 div 1 sub diamondWidth 2 div 1 sub neg rlineto
  1176.     diamondWidth 2 div 1 sub neg diamondWidth 2 div 1 sub neg rlineto
  1177.     closepath
  1178.     byvalue 0 eq { 1 setgray }{ 0 setgray } ifelse fill
  1179.  
  1180.     newpath 1 setlinewidth 0 setgray
  1181.     diax diamondWidth 2 div sub diay moveto
  1182.  
  1183.     diamondWidth 2 div 0.5 sub diamondWidth 2 div 0.5 sub rlineto
  1184.     diamondWidth 2 div 0.5 sub diamondWidth 2 div 0.5 sub neg rlineto
  1185.     diamondWidth 2 div 0.5 sub neg diamondWidth 2 div 0.5 sub neg rlineto
  1186.     closepath stroke
  1187.  
  1188.     end
  1189. } def
  1190.  
  1191.  
  1192. /genarrowdict 15 dict def
  1193. genarrowdict begin
  1194. /mtrx matrix def
  1195. end
  1196.  
  1197. /drawGenArrow %     tailx taily tipx tipy halfthickness halfheadthickness headlength dashed filled drawGenArrow
  1198. { genarrowdict begin
  1199.     /filled exch def
  1200.     /dashed exch def
  1201.     /headlength exch def
  1202.     /halfheadthickness exch 2 div def
  1203.     /halfthickness exch 2 div def
  1204.     /tipy exch def /tipx exch def
  1205.     /taily exch def /tailx exch def
  1206.  
  1207.     /dx tipx tailx sub def
  1208.     /dy tipy taily sub def
  1209.     /arrowlength dx dx mul dy dy mul add sqrt halfthickness sub def
  1210.     /angle dy dx atan def
  1211.     /base arrowlength headlength sub def
  1212.     /savematrix mtrx currentmatrix def
  1213.     tailx taily translate
  1214.     angle rotate
  1215.     base halfthickness neg moveto
  1216.     base halfheadthickness neg lineto
  1217.     arrowlength 0 lineto
  1218.     base halfheadthickness lineto
  1219.     base halfthickness lineto
  1220.     closepath
  1221.     filled true eq { fill }{ gsave 1 setgray fill grestore stroke } ifelse
  1222.     savematrix setmatrix
  1223.     newpath 1 setlinewidth
  1224.     tailx taily translate
  1225.     angle rotate
  1226.     dashed true eq { [3] 0 setdash }if
  1227.     0 0 moveto base 0 lineto stroke
  1228.     dashed true eq { [] 0 setdash }if
  1229.     savematrix setmatrix
  1230.     end
  1231. } def
  1232.  
  1233. % [ pointn ... point1 noOfPoints branchRole branchMultText branchMult navigable ] noOfBranches pointn ... point1 noOfPoints baseRole baseMultText baseMult qualPos qualifier name pyramidorientation pyramidx pyramidy omtNotation
  1234. /drawGen
  1235. {
  1236.     50 dict begin
  1237.     Monaco9 setfont
  1238.  
  1239.     /omtNotation exch def
  1240.     /pyry exch def
  1241.     /pyrx exch def
  1242.     /orient exch def
  1243.     /name exch def
  1244.       /noOfStemPoints exch def
  1245.     /stemArray noOfStemPoints 2 mul array def
  1246.     /index 0 def
  1247.     {
  1248.         index noOfStemPoints 2 mul eq { exit } if
  1249.         stemArray index 3 -1 roll put
  1250.         /index index 1 add def
  1251.     } loop
  1252.  
  1253.     /noOfBranches exch def
  1254.     /branchesArray noOfBranches array def
  1255.  
  1256.     /index 0 def
  1257.     {
  1258.         index noOfBranches eq { exit } if
  1259.  
  1260.         /navigable exch def
  1261.         /branchMult exch def /branchMultText exch def
  1262.         /branchRole exch def /noOfBranchPoints exch def
  1263.  
  1264.         noOfBranchPoints 0 ne {
  1265.             /pntArray noOfBranchPoints 2 mul array def
  1266.             /pntIndex 0 def
  1267.             {
  1268.                 pntIndex noOfBranchPoints 2 mul eq { exit } if
  1269.                 pntArray pntIndex 3 -1 roll put
  1270.                 /pntIndex pntIndex 1 add def
  1271.             } loop
  1272.  
  1273.             /branchArray 2 array def
  1274.           branchArray 0 noOfBranchPoints put branchArray 1 pntArray put
  1275.         }
  1276.         {
  1277.             /branchArray 1 array def
  1278.           branchArray 0 noOfBranchPoints put
  1279.         } ifelse
  1280.         branchesArray index branchArray put
  1281.         /index index 1 add def
  1282.     } loop
  1283.     newpath 1 setlinewidth 0 setgray
  1284.     /index 0 def
  1285.     {
  1286.         index noOfStemPoints eq { exit } if
  1287.         stemArray index 2 mul 1 add get stemArray index 2 mul get
  1288.         index 0 eq { moveto }{ lineto } ifelse
  1289.         /index index 1 add def
  1290.     } loop
  1291.  
  1292.     branchesArray
  1293.     {
  1294.         /branch exch def
  1295.         /noOfPoints branch 0 get def
  1296.         noOfPoints 0 ne {
  1297.             /pntArray branch 1 get def
  1298.             /index 0 def
  1299.             {
  1300.                 index noOfPoints eq { exit } if
  1301.                 pntArray index 2 mul 1 add get pntArray index 2 mul get
  1302.                 index 0 eq { moveto }{ lineto } ifelse
  1303.                 /index index 1 add def
  1304.             } loop
  1305.         }if
  1306.     }forall
  1307.     stroke
  1308.  
  1309.     newpath
  1310.     pyrx pyry moveto
  1311.  
  1312.     omtNotation 1 eq {
  1313.         orient 0 eq {
  1314.             pyramidWidth 2 div 1.6 sub 0 rlineto
  1315.             pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub rlineto
  1316.             pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub neg rlineto
  1317.         } if
  1318.         orient 2 eq {
  1319.             0 pyramidWidth 2 div 1.6 sub rlineto
  1320.             pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub neg rlineto
  1321.             pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub neg rlineto
  1322.         } if
  1323.         orient 4 eq {
  1324.             pyramidWidth 2 div 1.6 sub neg 0 rlineto
  1325.             pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub neg rlineto
  1326.             pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub rlineto
  1327.         } if
  1328.         orient 6 eq {
  1329.             0 pyramidWidth 2 div 1.6 sub neg rlineto
  1330.             pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub rlineto
  1331.             pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub rlineto
  1332.         } if
  1333.         closepath 1 setgray fill
  1334.  
  1335.         newpath 1 setlinewidth 0 setgray
  1336.         pyrx pyry moveto
  1337.  
  1338.         orient 0 eq {
  1339.             pyramidWidth 2 div 0.5 sub 0 rlineto
  1340.             pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub rlineto
  1341.             pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub neg rlineto
  1342.         } if
  1343.         orient 2 eq {
  1344.             0 pyramidWidth 2 div 0.5 sub rlineto
  1345.             pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub neg rlineto
  1346.             pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub neg rlineto
  1347.         } if
  1348.         orient 4 eq {
  1349.             pyramidWidth 2 div 0.5 sub neg 0 rlineto
  1350.             pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub neg rlineto
  1351.             pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub rlineto
  1352.         } if
  1353.         orient 6 eq {
  1354.             0 pyramidWidth 2 div 0.5 sub neg rlineto
  1355.             pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub rlineto
  1356.             pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub rlineto
  1357.         } if
  1358.         closepath stroke
  1359.     }
  1360.     {
  1361.         /i noOfStemPoints 2 mul def
  1362.         stemArray i 3 sub get stemArray i 4 sub get stemArray i 1 sub get stemArray i 2 sub get 1 15 20 false false drawGenArrow
  1363.     } ifelse
  1364.     
  1365.     end
  1366. } def
  1367.  
  1368. % pointn ... point1 noOfPoints name drawUCGen
  1369. /drawUCGen
  1370. {
  1371.     50 dict begin
  1372.  
  1373.     /name exch def
  1374.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  1375.     {
  1376.         index noOfPoints 2 mul eq { exit } if
  1377.         pntArray index 3 -1 roll put
  1378.         /index index 1 add def
  1379.     } loop
  1380.  
  1381.     Monaco9 setfont
  1382.     newpath 1 setlinewidth
  1383.     noOfPoints 2 gt {
  1384.         /index 0 def
  1385.         {
  1386.             index noOfPoints 1 sub eq { exit } if
  1387.             /p1.h pntArray index 2 mul 1 add get def
  1388.             /p1.v pntArray index 2 mul get def
  1389.             /p2.h pntArray index 1 add 2 mul 1 add get def
  1390.             /p2.v pntArray index 1 add 2 mul get def
  1391.             p1.h p1.v moveto p2.h p2.v lineto stroke
  1392.             /index index 1 add def
  1393.         } loop
  1394.     } if
  1395.  
  1396.     /p1.h pntArray 1 get def
  1397.     /p1.v pntArray 0 get def
  1398.     /p2.h pntArray 3 get def
  1399.     /p2.v pntArray 2 get def
  1400.     p2.h p2.v p1.h p1.v  1 15 20 false false drawGenArrow
  1401.  
  1402.     /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  1403.     /p1.v pntArray noOfPoints 1 sub 2 mul get def
  1404.     /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def
  1405.     /p2.v pntArray noOfPoints 2 sub 2 mul get def
  1406.  
  1407.     /width name stringwidth pop def
  1408.  
  1409.     p1.v p2.v eq {
  1410.         /p.v p1.v 7 add def
  1411.  
  1412.         p1.h p2.h lt {
  1413.             /p.h p2.h p1.h sub 2 div width 2 div sub p1.h add def
  1414.         }
  1415.         {
  1416.             /p.h p1.h p2.h sub 2 div width 2 div sub p2.h add def
  1417.         } ifelse
  1418.     }
  1419.     {
  1420.         p1.h p2.h eq {
  1421.             /p.h p1.h 5 add def
  1422.  
  1423.             p1.v p2.v lt {
  1424.                 /p.v p2.v p1.v sub 2 div p1.v add def
  1425.             }
  1426.             {
  1427.                 /p.v p1.v p2.v sub 2 div p2.v add def
  1428.             } ifelse
  1429.         }
  1430.         {
  1431.             p1.v p2.v lt {
  1432.                 /p.v p2.v p1.v sub 2 div p1.v add def
  1433.             }
  1434.             {
  1435.                 /p.v p1.v p2.v sub 2 div p2.v add def
  1436.             } ifelse
  1437.             
  1438.             p1.h p2.h lt {
  1439.                 /p.h p2.h p1.h sub 2 div width 2 div sub p1.h add def
  1440.             }
  1441.             {
  1442.                 /p.h p1.h p2.h sub 2 div width 2 div sub p2.h add def
  1443.             } ifelse
  1444.         }ifelse
  1445.     } ifelse
  1446.  
  1447.     p.h p.v moveto name show
  1448.  
  1449.     end
  1450. } def
  1451.  
  1452. /drawEventBox        % ulc.x ulc.y height
  1453. {
  1454.     50 dict begin
  1455.  
  1456.     /height exch def /ulcy exch def /ulcx exch def
  1457.  
  1458.     newpath 1 setlinewidth
  1459.     ulcx ulcy moveto eventBoxWidth 0 rlineto 0 height neg rlineto
  1460.     eventBoxWidth neg 0 rlineto closepath
  1461.     gsave stroke grestore
  1462.     1 setgray fill
  1463.     0 setgray fill
  1464.     end
  1465. } def
  1466.  
  1467. /drawEventThread    % ulc.x ulc.y height name
  1468. {
  1469.     50 dict begin
  1470.  
  1471.     /name exch def /height exch def /ulcy exch def /ulcx exch def
  1472.  
  1473.     newpath 1 setlinewidth
  1474.     Monaco10 setfont
  1475.     1 setlinewidth ulcx ulcy moveto 0 height neg rlineto stroke
  1476.     ulcx name stringwidth pop 2 div sub ulcy 10 add moveto name show
  1477.     end
  1478. } def
  1479.  
  1480. /drawEventEvent        % fulcx fulcy flrcx flrcy ulcx ulcy lrcx lrcy name dashed
  1481. {
  1482.     50 dict begin
  1483.  
  1484.     /dashed exch def /name exch def /lrcy exch def /lrcx exch def
  1485.     /ulcy exch def /ulcx exch def
  1486.     /flrcy exch def /flrcx exch def
  1487.     /fulcy exch def /fulcx exch def
  1488.  
  1489.     Monaco9 setfont
  1490.     newpath 1 setlinewidth
  1491.     ulcx ulcy lrcx lrcy 1 5 5 dashed true drawArrow
  1492.  
  1493.     fulcx flrcx gt
  1494.     {    % above to the left of p1
  1495.         /textx fulcx name stringwidth pop 3 add sub def
  1496.         /texty fulcy 2 add def
  1497.     }
  1498.     {    % above to the right of p1
  1499.         /textx fulcx 4 add def
  1500.         /texty fulcy 2 add def
  1501.     }ifelse
  1502.     textx texty moveto
  1503.     name show
  1504.     end
  1505. } def
  1506. /drawSupp        % pointn ... point1 noOfPoints name drawSupp
  1507. {
  1508.     50 dict begin
  1509.  
  1510.     /name exch def
  1511.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  1512.     {
  1513.         index noOfPoints 2 mul eq { exit } if
  1514.         pntArray index 3 -1 roll put
  1515.         /index index 1 add def
  1516.     } loop
  1517.  
  1518.     Monaco9 setfont
  1519.     [3] 0 setdash
  1520.     newpath 1 setlinewidth
  1521.     noOfPoints 2 gt {
  1522.         /index 0 def
  1523.         {
  1524.             index noOfPoints 1 sub eq { exit } if
  1525.             /p1.h pntArray index 2 mul 1 add get def
  1526.             /p1.v pntArray index 2 mul get def
  1527.             /p2.h pntArray index 1 add 2 mul 1 add get def
  1528.             /p2.v pntArray index 1 add 2 mul get def
  1529.             p1.h p1.v moveto p2.h p2.v lineto stroke
  1530.             /index index 1 add def
  1531.         } loop
  1532.     } if
  1533.  
  1534.     /p1.h pntArray 1 get def
  1535.     /p1.v pntArray 0 get def
  1536.     /p2.h pntArray 3 get def
  1537.     /p2.v pntArray 2 get def
  1538.     [] 0 setdash
  1539.     p2.h p2.v p1.h p1.v 1 15 20 true false drawGenArrow
  1540. %    p2.h p2.v p1.h p1.v 1 5 5 true drawNavArrow
  1541.  
  1542.     end
  1543. } def
  1544.  
  1545. /fourpops { pop pop pop pop } def
  1546. /drawRoundedBox % ulcx ulcy width height
  1547. {
  1548.     50 dict begin
  1549.  
  1550.     /height exch def /width exch def
  1551.     /ulcy exch def /ulcx exch def
  1552.  
  1553.     /lrcx ulcx width add def /lrcy ulcy height sub def
  1554.  
  1555.     ulcx lrcy 10 add moveto
  1556.     ulcx lrcy lrcx lrcy 5 arcto fourpops
  1557.     lrcx lrcy lrcx ulcy 5 arcto fourpops
  1558.     lrcx ulcy ulcx ulcy 5 arcto fourpops
  1559.     ulcx ulcy ulcx lrcy 5 arcto fourpops
  1560.     closepath
  1561.     gsave 1 setgray fill grestore stroke
  1562.     end
  1563. } def
  1564.  
  1565. /drawStateBox % actionn eventn .. action1 event1 noOfEvents exitlinen exitline1 noOfExitLines dolinen doline1 noOfDoLines entrylinen entryline1 noOfEntryLines name
  1566. {
  1567.     50 dict begin
  1568.  
  1569.     /boxheight 30 def
  1570.     /boxwidth 60 def
  1571.     /name exch def 
  1572.  
  1573. %
  1574. % Get all the entry/ lines and store them in entryLineArray
  1575. %
  1576.     /noOfEntryLines exch def
  1577.     /entryLineWidth 0 def     /entryHeight 0 def
  1578.     noOfEntryLines 0 ne
  1579.     { 
  1580.         /entryLineArray noOfEntryLines array def
  1581.         /entryLineIndex 0 def
  1582.         {
  1583.             entryLineIndex noOfEntryLines eq { exit } if
  1584.             entryLineArray entryLineIndex 3 -1 roll put
  1585.             /entryLineIndex entryLineIndex 1 add def
  1586.         } loop
  1587.         /entryHeight entryLineIndex 12 mul def
  1588.         /rubrikwidth MonacoI9 setfont (entry/ ) stringwidth pop def
  1589.         Monaco9 setfont
  1590.         entryLineArray
  1591.         {
  1592.             stringwidth pop dup rubrikwidth add 16 add
  1593.             entryLineWidth gt { /entryLineWidth exch def }{ pop } ifelse
  1594.         } forall
  1595.     } if
  1596.  
  1597. %
  1598. % Get all the do: lines and store them in doLineArray
  1599. %
  1600.     /noOfDoLines exch def
  1601.     /doLineWidth 0 def     /doHeight 0 def
  1602.     noOfDoLines 0 ne
  1603.     { 
  1604.         /doLineArray noOfDoLines array def
  1605.         /doLineIndex 0 def
  1606.         {
  1607.             doLineIndex noOfDoLines eq { exit } if
  1608.             doLineArray doLineIndex 3 -1 roll put
  1609.             /doLineIndex doLineIndex 1 add def
  1610.         } loop
  1611.         /doHeight doLineIndex 12 mul def
  1612.         /rubrikwidth Monaco9 setfont (do: ) stringwidth pop def
  1613.         doLineArray
  1614.         {
  1615.             stringwidth pop dup rubrikwidth add 16 add
  1616.             doLineWidth gt { /doLineWidth exch def }{ pop } ifelse
  1617.         } forall
  1618.     } if
  1619.  
  1620. %
  1621. % Get all the exit/ lines and store them in exitLineArray
  1622. %
  1623.     /noOfExitLines exch def
  1624.     /exitLineWidth 0 def     /exitHeight 0 def
  1625.     noOfExitLines 0 ne
  1626.     { 
  1627.         /exitLineArray noOfExitLines array def
  1628.         /exitLineIndex 0 def
  1629.         {
  1630.             exitLineIndex noOfExitLines eq { exit } if
  1631.             exitLineArray exitLineIndex 3 -1 roll put
  1632.             /exitLineIndex exitLineIndex 1 add def
  1633.         } loop
  1634.         /exitHeight exitLineIndex 12 mul def
  1635.         /rubrikwidth MonacoI9 setfont (exit/ ) stringwidth pop def
  1636.         Monaco9 setfont
  1637.         exitLineArray
  1638.         {
  1639.             stringwidth pop dup rubrikwidth add 16 add
  1640.             exitLineWidth gt { /exitLineWidth exch def }{ pop } ifelse
  1641.         } forall
  1642.     } if
  1643.  
  1644. %
  1645. % Get all the event/ lines and store each event in the eventsArray
  1646. % Each element of the eventsArray is another array where the first
  1647. % item holds the number of lines (following items)
  1648. %
  1649.     /noOfEvents exch def
  1650.     /eventHeight 0 def
  1651.     noOfEvents 0 ne
  1652.     { 
  1653.         /eventsArray noOfEvents array def
  1654.         /eventIndex 0 def
  1655.         {
  1656.             eventIndex noOfEvents eq { exit } if
  1657.             /noOfEventLines exch def
  1658.             /eventArray noOfEventLines 2 add array def
  1659.             eventArray 0 noOfEventLines put
  1660.             /lineIndex 1 def
  1661.             {
  1662.                 lineIndex noOfEventLines 2 add eq { exit } if
  1663.                 eventArray lineIndex 3 -1 roll put
  1664.                 /lineIndex lineIndex 1 add def
  1665.             } loop
  1666.             eventsArray eventIndex eventArray put
  1667.             /eventIndex eventIndex 1 add def
  1668.         } loop
  1669.  
  1670.         /eventLineWidth 0 def
  1671.  
  1672.         eventsArray
  1673.         {
  1674.             /ar exch def
  1675.             /noOfLines ar 0 get def
  1676.             /eventHeight eventHeight noOfLines add def
  1677.             /rubrikwidth ar noOfLines 1 add get MonacoI9 setfont stringwidth pop def
  1678.          Monaco9 setfont
  1679.             /item noOfLines def
  1680.             {
  1681.                 item 0 eq { exit } if
  1682.                 ar item get Monaco9 setfont stringwidth pop
  1683.                 rubrikwidth add 16 add dup
  1684.                 boxwidth gt { /boxwidth exch def }{ pop } ifelse
  1685.                 /item item 1 sub def
  1686.             } loop
  1687.         } forall
  1688.     /eventHeight eventHeight 10 mul def
  1689.     } if
  1690.  
  1691.     currentpoint /ulcy exch def /ulcx exch def
  1692.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  1693.  
  1694.     Monaco10 setfont
  1695.     name stringwidth pop dup 8 add
  1696.     boxwidth gt { /boxwidth exch def }{ pop } ifelse
  1697.  
  1698.     entryLineWidth boxwidth gt { /boxwidth entryLineWidth def } if
  1699.     doLineWidth boxwidth gt { /boxwidth doLineWidth def } if
  1700.     exitLineWidth boxwidth gt { /boxwidth exitLineWidth def } if
  1701.  
  1702.     30 exitHeight add doHeight add entryHeight add eventHeight add dup
  1703.     boxheight gt { /boxheight exch def }{ pop } ifelse
  1704.  
  1705. % Draw the name of the state
  1706.     Monaco10 setfont
  1707.     ulcx ulcy boxwidth boxheight drawRoundedBox
  1708.     ulcx boxwidth name stringwidth pop sub 2 div add
  1709.     ulcy 18 sub moveto name show
  1710.  
  1711.     /entryIndex 0 def
  1712.     entryHeight 0 ne
  1713.     {
  1714.         /item noOfEntryLines 1 sub def
  1715.         {
  1716.             item -1 eq { exit }if
  1717.             entryLineArray item get
  1718.             /item item 1 sub def
  1719.             ulcx 5 add ulcy 30 sub entryIndex 10 mul sub moveto
  1720.             entryIndex 0 eq { MonacoI9 setfont (entry/ ) show
  1721.                                                                 /leftmargin currentpoint pop ulcx 5 add sub def Monaco9 setfont }
  1722.                                                                 { leftmargin 0 rmoveto } ifelse
  1723.             show
  1724.             /entryIndex entryIndex 1 add def
  1725.         } loop
  1726.     } if
  1727.     Monaco9 setfont
  1728.     /doIndex 0 def
  1729.     doHeight 0 ne
  1730.     {
  1731.         /item noOfDoLines 1 sub def
  1732.         {
  1733.             item -1 eq { exit }if
  1734.             doLineArray item get
  1735.             /item item 1 sub def
  1736.             ulcx 5 add ulcy 30 sub doIndex 10 mul sub entryIndex 10 mul sub moveto
  1737.             doIndex 0 eq { (do: ) show /leftmargin currentpoint pop ulcx 5 add sub def }{ leftmargin 0 rmoveto } ifelse
  1738.             show
  1739.             /doIndex doIndex 1 add def
  1740.         } loop
  1741.     } if
  1742.  
  1743.     /eventIndex 0 def
  1744.     eventHeight 0 ne
  1745.     {
  1746.         /item noOfEvents 1 sub def
  1747.         {
  1748.             item -1 eq { exit }if
  1749.             /ar eventsArray item get def
  1750.             /item item 1 sub def
  1751.             /noOfLines ar 0 get def
  1752.             /lineIndex noOfLines 1 add def
  1753.             {
  1754.                 lineIndex 0 eq { exit } if
  1755.                 ar lineIndex get
  1756.                 ulcx 5 add ulcy 32 sub entryIndex 10 mul sub doIndex 10 mul sub eventIndex 10 mul sub moveto
  1757.                 lineIndex noOfLines 1 add eq
  1758.                 {
  1759.                     MonacoI9 setfont show ( ) show  /leftmargin currentpoint pop ulcx 5 add sub def
  1760.                     ar noOfLines get Monaco9 setfont show
  1761.                     /lineIndex lineIndex 2 sub def
  1762.                 }
  1763.                 {
  1764.                     leftmargin 0 rmoveto show
  1765.                     /lineIndex lineIndex 1 sub def
  1766.                 }ifelse
  1767.                 /eventIndex eventIndex 1 add def
  1768.             } loop
  1769.         } loop
  1770.     } if
  1771.  
  1772.     /exitIndex 0 def
  1773.     exitHeight 0 ne
  1774.     {
  1775.         /item noOfExitLines 1 sub def
  1776.         {
  1777.             item -1 eq { exit }if
  1778.             exitLineArray item get
  1779.             /item item 1 sub def
  1780.             ulcx 5 add ulcy 32 sub entryIndex 10 mul sub doIndex 10 mul sub eventIndex 10 mul sub exitIndex 10 mul sub moveto
  1781.             exitIndex 0 eq { MonacoI9 setfont (exit/ ) show
  1782.             /leftmargin currentpoint pop ulcx 5 add sub def
  1783.             Monaco9 setfont } { leftmargin 0 rmoveto }ifelse
  1784.             show
  1785.             /exitIndex exitIndex 1 add def
  1786.         } loop
  1787.     } if
  1788.     leftmargin boxwidth add topmargin boxheight sub
  1789.     end
  1790. } def
  1791.  
  1792. /drawStateEvent % [ pointn ... point1 ] noOfPoints eventtext
  1793.     50 dict begin
  1794.     Monaco9 setfont
  1795.  
  1796.     /eventtext exch def
  1797.  
  1798.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  1799.     {
  1800.         index noOfPoints 2 mul eq { exit } if
  1801.         pntArray index 3 -1 roll put
  1802.         /index index 1 add def
  1803.     } loop
  1804.  
  1805.     newpath 1 setlinewidth 0 setgray
  1806.     /index 0 def
  1807.     {
  1808.         index noOfPoints eq { exit } if
  1809.         pntArray index 2 mul 1 add get pntArray index 2 mul get
  1810.         index 0 eq { moveto }{ lineto } ifelse
  1811.         /index index 1 add def
  1812.     } loop
  1813.     stroke
  1814.     pntArray noOfPoints 1 sub 2 mul 1 add get pntArray noOfPoints 1 sub 2 mul get
  1815.     pntArray noOfPoints 2 sub 2 mul 1 add get pntArray noOfPoints 2 sub 2 mul get
  1816.  
  1817. %
  1818. % Last line's x and y are on top of the stack
  1819. %
  1820.     /p1.v exch def
  1821.     /p1.h exch def
  1822.     /p2.v exch def
  1823.     /p2.h exch def
  1824.     /width eventtext stringwidth pop def
  1825.  
  1826.     p1.v p2.v eq
  1827.     {
  1828.         /p.v p1.v 7 add def
  1829.         p1.h p2.h lt
  1830.         {
  1831.             /p.h p1.h p2.h p1.h sub 2 div add  width 2 div   sub def
  1832.         }
  1833.         {
  1834.             /p.h p2.h p1.h p2.h sub 2 div add   width 2 div   sub def
  1835.         }ifelse
  1836.     }
  1837.     {
  1838.         p1.h p2.h eq
  1839.         {
  1840.             /p.h p1.h 5 add def
  1841.             p1.v p2.v ge
  1842.             {
  1843.                 /p.v p1.v p2.v p1.v sub 2 div add def
  1844.             }
  1845.             {
  1846.                 /p.v p2.v p1.v p2.v sub 2 div add def
  1847.             }ifelse
  1848.         }
  1849.         {
  1850.             p1.v p2.v ge
  1851.             {
  1852.                 /p.v  p1.v p2.v p1.v sub 2 div add def
  1853.             }
  1854.             {
  1855.                 /p.v  p2.v p1.v p2.v sub 2 div add def
  1856.             }ifelse
  1857.  
  1858.             p1.h p2.h lt
  1859.             {
  1860.                 /p.h  p1.h p2.h p1.h sub 2 div width 2 div sub add def
  1861.             }
  1862.             {
  1863.                 /p.h  p2.h p1.h p2.h sub 2 div width 2 div sub add def
  1864.             }ifelse
  1865.         }ifelse
  1866.     }ifelse
  1867.  
  1868.     MonacoI9 setfont
  1869.     p.h p.v moveto eventtext show
  1870.  
  1871.     pntArray 1 get pntArray 0 get
  1872.     /p1.v exch def /p1.h exch def
  1873.     pntArray 3 get pntArray 2 get
  1874.     /p2.v exch def /p2.h exch def
  1875.  
  1876.     p1.h p2.h eq
  1877.     {
  1878.         p1.v p2.v gt
  1879.         {
  1880.             /p1.v p1.v 5 sub def
  1881.         }
  1882.         {
  1883.             /p1.v p1.v 5 add def
  1884.         }ifelse
  1885.     }
  1886.     {
  1887.         p1.h p2.h gt
  1888.         {
  1889.             /p1.h p1.h 5 sub def
  1890.         }
  1891.         {
  1892.             /p1.h p1.h 5 add def
  1893.         }ifelse
  1894.     } ifelse
  1895.  p2.h p2.v p1.h p1.v 1 5 5 false true drawArrow
  1896.  
  1897.     end
  1898. } def
  1899.  
  1900. /drawNote %  linen line1 noOfLines width height drawNote
  1901. {
  1902.     50 dict begin
  1903.  
  1904.     /boxheight exch def
  1905.     /boxwidth exch def
  1906.  
  1907. %
  1908. % Get all the lines and store them in lineArray
  1909. %
  1910.     Monaco9 setfont
  1911.  
  1912.     /noOfLines exch def
  1913.     noOfLines 0 ne
  1914.     { 
  1915.         /lineArray noOfLines array def
  1916.         /lineIndex 0 def
  1917.         {
  1918.             lineIndex noOfLines eq { exit } if
  1919.             lineArray lineIndex 3 -1 roll put
  1920.             /lineIndex lineIndex 1 add def
  1921.         } loop
  1922.     } if
  1923.  
  1924.     currentpoint /ulcy exch def /ulcx exch def
  1925.  
  1926.     % compute max width of text lines
  1927.     /maxwidth 0 def
  1928.     noOfLines 0 ne
  1929.     {
  1930.         /item noOfLines 1 sub def
  1931.         {
  1932.             item -1 eq { exit }if
  1933.             lineArray item get
  1934.             stringwidth pop
  1935.             /width exch def
  1936.             maxwidth width lt { /maxwidth width def }if
  1937.             /item item 1 sub def
  1938.         } loop
  1939.     } if
  1940.     boxwidth maxwidth lt { /boxwidth maxwidth def }if
  1941.  
  1942.     % draw the box
  1943.     currentpoint boxwidth 0 rlineto
  1944.     0 boxheight neg rlineto
  1945.     boxwidth neg 0 rlineto closepath stroke
  1946.  
  1947.     % set clipping region
  1948.     gsave
  1949.     newpath
  1950.     ulcx 5 add ulcy moveto
  1951.     boxwidth 10 sub 0 rlineto
  1952.     0 boxheight neg rlineto
  1953.     boxwidth 10 sub neg 0 rlineto closepath clip
  1954.  
  1955.     /index 0 def
  1956.     noOfLines 0 ne
  1957.     {
  1958.         /item noOfLines 1 sub def
  1959.         {
  1960.             item -1 eq { exit }if
  1961.             lineArray item get
  1962.             /item item 1 sub def
  1963.             ulcx 5 add ulcy 12 sub index 10 mul sub moveto
  1964.             show
  1965.             /index index 1 add def
  1966.         } loop
  1967.     } if
  1968.     grestore
  1969.     newpath
  1970.     ulcx boxwidth add 14 sub ulcy moveto
  1971.     14 0 rlineto
  1972.     0 -10 rlineto closepath gsave stroke grestore 0.5 setgray fill
  1973.  
  1974.     2 setlinejoin
  1975.     ulcx boxwidth add 14 sub ulcy moveto
  1976.  
  1977.     ulcx boxwidth add 12 sub ulcy 3 sub        % x1, y1
  1978.     ulcx boxwidth add 11 sub ulcy 5 sub        % x2, y2
  1979.     ulcx boxwidth add 12 sub ulcy 10 sub    % x3, y3
  1980.     curveto
  1981.  
  1982.     ulcx boxwidth add 9 sub ulcy 8 sub    % x1, y1
  1983.     ulcx boxwidth add 4 sub ulcy 8 sub    % x2, y2
  1984.     ulcx boxwidth add ulcy 10 sub        % x3, y3
  1985.     curveto
  1986.  
  1987.     closepath gsave 1 setgray fill grestore 0 setgray stroke
  1988.     0 setlinejoin
  1989.  
  1990.     ulcx boxwidth add ulcy boxheight sub
  1991.  
  1992.     end
  1993. } def
  1994.  
  1995.  
  1996. /drawInitialState %  diameter x y drawInitialState
  1997. {
  1998.     50 dict begin
  1999.  
  2000.     /y exch def
  2001.     /x exch def
  2002.     /circleSize exch def
  2003.     newpath
  2004.     x circleSize 2 div add
  2005.     y circleSize 2 div sub
  2006.     circleSize 2 div
  2007.     0 360 arc
  2008.     closepath gsave stroke grestore fill
  2009.  
  2010.     end
  2011. } def
  2012.  
  2013. /drawFinalState %  diameter x y drawFinalState
  2014. {
  2015.     50 dict begin
  2016.  
  2017.     /y exch def
  2018.     /x exch def
  2019.     /circleSize exch def
  2020.     newpath
  2021.     x circleSize 2 div add
  2022.     y circleSize 2 div sub
  2023.     circleSize 2 div
  2024.     0 360 arc
  2025.     closepath stroke
  2026.     newpath
  2027.     x circleSize 2 div add
  2028.     y circleSize 2 div sub
  2029.     circleSize 2 div 3 sub
  2030.     0 360 arc
  2031.     closepath fill
  2032.  
  2033.     end
  2034. } def
  2035.  
  2036. /drawActor %  name
  2037. {
  2038.     50 dict begin
  2039.  
  2040.     /actorheight 75 def
  2041.     /actorwidth 30 def
  2042.     /name exch def 
  2043.  
  2044.     currentpoint /ulcy exch def /ulcx exch def
  2045.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  2046.  
  2047.     Monaco10 setfont
  2048.     /namewidth name stringwidth pop def
  2049.  
  2050.     /nameleft ulcx actorwidth 2 div add namewidth 2 div sub def
  2051.  
  2052. % Draw the name of the actor
  2053.     nameleft ulcy actorheight sub 5 add moveto name show
  2054.  
  2055. % Draw the stickman
  2056.     
  2057. % First head
  2058.     newpath
  2059.     ulcx actorwidth 2 div add    % x
  2060.     ulcy 10 sub                    % y
  2061.     10                            % r
  2062.     0 360 arc stroke
  2063.  
  2064. % then body
  2065.     newpath
  2066.     ulcx actorwidth 2 div add ulcy 20 sub moveto
  2067.     ulcx actorwidth 2 div add ulcy 20 sub actorheight 45 sub sub lineto
  2068.  
  2069. % then the legs
  2070.     actorwidth 2 div 1 sub neg -10 rlineto
  2071.     actorwidth 2 div 10 rmoveto
  2072.     actorwidth 2 div -10 rlineto
  2073.  
  2074. % then the arms
  2075.     ulcx ulcy 35 sub moveto
  2076.     actorwidth 2 div 5 rlineto
  2077.     actorwidth 2 div 1 sub -5 rlineto
  2078.     stroke
  2079.  
  2080.     leftmargin actorwidth add topmargin actorheight sub
  2081.     end
  2082. } def
  2083.  
  2084. /drawPackage %  name
  2085. {
  2086.     50 dict begin
  2087.  
  2088.     /packageheight 50 def
  2089.     /packagewidth 80 def
  2090.     /name exch def 
  2091.  
  2092.     currentpoint /ulcy exch def /ulcx exch def
  2093.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  2094.  
  2095.     Monaco10 setfont
  2096.     /namewidth name stringwidth pop def
  2097.  
  2098.     namewidth 6 add packagewidth gt { /packagewidth namewidth 6 add def } if
  2099.  
  2100.     /nameleft ulcx packagewidth 2 div add namewidth 2 div sub def
  2101.  
  2102.     ulcx ulcy 10 sub moveto
  2103.     ulcx packagewidth add ulcy 10 sub lineto
  2104.     ulcx packagewidth add ulcy packageheight sub 1 add lineto
  2105.     ulcx ulcy packageheight sub 1 add lineto
  2106.     closepath stroke
  2107.     newpath
  2108.     ulcx ulcy moveto
  2109.     ulcx 30 add ulcy lineto
  2110.     ulcx 30 add ulcy 10 sub lineto
  2111.     ulcx ulcy 10 sub lineto
  2112.     closepath stroke
  2113.  
  2114.     newpath
  2115.     nameleft ulcy 25 sub moveto
  2116.     name show
  2117.  
  2118.     leftmargin packagewidth add topmargin packageheight sub
  2119.     end
  2120. } def
  2121. /drawFrame %  width height
  2122. {
  2123.     50 dict begin
  2124.  
  2125.     /frameheight exch def
  2126.     /framewidth exch def
  2127.  
  2128.     currentpoint /ulcy exch def /ulcx exch def
  2129.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  2130.  
  2131.     ulcx framewidth add ulcy lineto
  2132.     ulcx framewidth add ulcy frameheight sub 1 add lineto
  2133.     ulcx ulcy frameheight sub 1 add lineto
  2134.     closepath stroke
  2135.  
  2136.     leftmargin framewidth add topmargin frameheight sub
  2137.     end
  2138. } def
  2139.  
  2140. /drawUseCase %  extensionPoint1 extensionPointn noOfExtensionPoints name
  2141. {
  2142.     50 dict begin
  2143.  
  2144.     /usecaseheight 50 def
  2145.     /usecasewidth 90 def
  2146.     /name exch def 
  2147.  
  2148.     Monaco10 setfont
  2149.     /namewidth name stringwidth pop def
  2150.     /maxWidth namewidth def
  2151.  
  2152.     Monaco9 setfont
  2153.  
  2154. % Get all extensionPoints
  2155.     /noOfExtensionPoints exch def 
  2156.     noOfExtensionPoints 0 ne
  2157.     { 
  2158.         /extensionPointArray noOfExtensionPoints array def
  2159.         /extensionPointIndex 0 def
  2160.         {
  2161.             extensionPointIndex noOfExtensionPoints eq { exit } if
  2162.             extensionPointArray extensionPointIndex 3 -1 roll put
  2163.  
  2164.             /extensionPointWidth extensionPointArray extensionPointIndex get stringwidth pop def
  2165.             extensionPointWidth namewidth gt { /maxWidth extensionPointWidth def } if
  2166.  
  2167.             /extensionPointIndex extensionPointIndex 1 add def
  2168.         } loop
  2169.     } if
  2170.  
  2171.     currentpoint /ulcy exch def /ulcx exch def
  2172.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  2173.  
  2174. % Adjust maxWidth if there are a lot of extensionPoints
  2175.     maxWidth noOfExtensionPoints 10 mul namewidth add lt { /maxWidth  noOfExtensionPoints 10 mul namewidth add def } if
  2176.  
  2177.     noOfExtensionPoints 0 ne { /usecaseheight noOfExtensionPoints 10 mul usecaseheight add def } if
  2178.  
  2179.     maxWidth 6 add usecasewidth gt { /usecasewidth maxWidth 6 add def } if
  2180.  
  2181.     /nameleft ulcx usecasewidth 2 div add namewidth 2 div sub def
  2182.  
  2183.     newpath
  2184.     ulcx usecasewidth 2 div add ulcy usecaseheight 2 div sub translate
  2185.     usecasewidth usecaseheight div 1 scale
  2186.     0 0 usecaseheight 2 div 0 360 arc
  2187.     usecaseheight usecasewidth div 1 scale
  2188.     ulcx usecasewidth 2 div add neg ulcy usecaseheight 2 div sub neg translate
  2189.     stroke
  2190.  
  2191. % Set a clipping path equal to the ellipse to avoid names and lines getting outside
  2192.     newpath
  2193.     ulcx usecasewidth 2 div add ulcy usecaseheight 2 div sub translate
  2194.     usecasewidth usecaseheight div 1 scale
  2195.     0 0 usecaseheight 2 div 0 360 arc
  2196.     usecaseheight usecasewidth div 1 scale
  2197.     ulcx usecasewidth 2 div add neg ulcy usecaseheight 2 div sub neg translate
  2198.     closepath
  2199.     clip
  2200.  
  2201. % Draw the name
  2202.     Monaco10 setfont
  2203.     newpath
  2204.     noOfExtensionPoints 0 eq { nameleft ulcy 25 sub moveto }{ nameleft ulcy 20 sub moveto }ifelse
  2205.     name show
  2206.  
  2207. % Draw extensionPoints if any
  2208.     Monaco9 setfont
  2209.     noOfExtensionPoints 0 ne {
  2210.         newpath
  2211.         ulcx ulcy 25 sub moveto
  2212.         ulcx usecasewidth add ulcy 25 sub lineto
  2213.         stroke
  2214.  
  2215.         /extensionWidth (extension points) stringwidth pop def
  2216.         usecasewidth extensionWidth sub 2 div ulcx add ulcy 35 sub moveto
  2217.         (extension points) show
  2218.  
  2219. %       Then output all names below the line
  2220.         /index noOfExtensionPoints 1 sub def
  2221.         {
  2222.             extensionPointArray index get
  2223.             stringwidth pop
  2224.             /width exch def
  2225.  
  2226.             usecasewidth width sub 2 div ulcx add ulcy 35 sub noOfExtensionPoints index sub 10 mul sub moveto
  2227.             extensionPointArray index get show
  2228.  
  2229.             index 0 eq { exit } if
  2230.  
  2231.             /index index 1 sub def
  2232.         } loop
  2233.     } if
  2234.  
  2235.     initclip
  2236.  
  2237.     leftmargin usecasewidth add topmargin usecaseheight sub
  2238.     end
  2239. } def
  2240.  
  2241. /drawText %  linen line1 noOfLines typeface size drawText
  2242. {
  2243.     50 dict begin
  2244.  
  2245.     /size exch def
  2246.     /typeface exch def
  2247.  
  2248. %
  2249. % Get all the lines and store them in lineArray
  2250. %
  2251. %    stdencoding typeface RE findfont size scalefont def
  2252.     typeface findfont size scalefont setfont
  2253.  
  2254.     /noOfLines exch def
  2255.     noOfLines 0 ne
  2256.     { 
  2257.         /lineArray noOfLines array def
  2258.         /lineIndex 0 def
  2259.         {
  2260.             lineIndex noOfLines eq { exit } if
  2261.             lineArray lineIndex 3 -1 roll put
  2262.             /lineIndex lineIndex 1 add def
  2263.         } loop
  2264.     } if
  2265.  
  2266.     currentpoint /ulcy exch def /ulcx exch def
  2267.  
  2268.     % compute max width of text lines
  2269.     /maxwidth 0 def
  2270.     noOfLines 0 ne
  2271.     {
  2272.         /item noOfLines 1 sub def
  2273.         {
  2274.             item -1 eq { exit }if
  2275.             lineArray item get
  2276.             stringwidth pop
  2277.             /width exch def
  2278.             maxwidth width lt { /maxwidth width def }if
  2279.             /item item 1 sub def
  2280.         } loop
  2281.     } if
  2282.  
  2283.     /index 0 def
  2284.     noOfLines 0 ne
  2285.     {
  2286.         /item noOfLines 1 sub def
  2287.         {
  2288.             item -1 eq { exit }if
  2289.             lineArray item get
  2290.             /item item 1 sub def
  2291.             ulcx 5 add ulcy 12 sub index 10 mul sub moveto
  2292.             show
  2293.             /index index 1 add def
  2294.         } loop
  2295.     } if
  2296.  
  2297.     end
  2298. } def
  2299.  
  2300. /drawCommunicates    % pointn ... point1 noOfPoints name
  2301. {
  2302.     50 dict begin
  2303.     Monaco9 setfont
  2304.  
  2305.     /name exch def
  2306.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  2307.     {
  2308.         index noOfPoints 2 mul eq { exit } if
  2309.         pntArray index 3 -1 roll put
  2310.         /index index 1 add def
  2311.     } loop
  2312.  
  2313.     newpath 1 setlinewidth 0 setgray
  2314.     /index 0 def
  2315.     {
  2316.         index noOfPoints eq { exit } if
  2317.         pntArray index 2 mul 1 add get pntArray index 2 mul get
  2318. %        index noOfPoints 1 sub eq { pop pop lineConnect.h lineConnect.v } if
  2319.         index 0 eq { moveto }{ lineto } ifelse
  2320.         /index index 1 add def
  2321.     } loop
  2322.     stroke
  2323.     end
  2324. } def
  2325.  
  2326. newpath 1 setlinewidth
  2327. 0 setgray
  2328.